package x.ovo.wechat.bot.common.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 登录方式
 *
 * @author ovo, created by 2024/04/21
 */
@Getter
@RequiredArgsConstructor
public enum LoginMode {
    FAILURE(400, "二维码失效，请重新扫描二维码"),
    WAITING(401, "等待扫码中"),
    TIMEOUT(408, "登录超时，请重新扫描二维码"),
    SCANED(201, "已扫描二维码，请确认登录"),
    SUCCESS(200, "已确认登录");

    private final int code;
    private final String message;

    public static LoginMode get(int code) {
        for (LoginMode loginMode : LoginMode.values()) {
            if (loginMode.code == code) {
                return loginMode;
            }
        }
        return null;
    }
}
